﻿<%@ Page Language="C#"  MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Inherits="Nivdal.LeagueFixtures" Title=" " StyleSheetTheme="SkinFile" Codebehind="LeagueFixtures.aspx.cs" %>

<asp:Content ID="PageNameContent" ContentPlaceHolderID="PageNamePlaceHolder" runat="server">
    <asp:Label ID="PageNameLabel" runat="server" Text="<%$ Resources:Resource, LeagueFixtures_PageNameLabel %>" CssClass="PageNameContentStyle"></asp:Label>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    
    <asp:UpdatePanel ID="FixturesUpdatePanel" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <div class="basic_element">
            <div class="red_title">
               <asp:HyperLink ID="LeaguefixturesTitleHyperlink" runat="server" CssClass="white_title"></asp:HyperLink>
            </div>
            <div class="padding5">
            <asp:HiddenField ID="LanguageHiddenField" runat="server" />
            <br />
            <br />
            <asp:Label ID="ChooseSeasonLabel" runat="server" Text="<%$ Resources:Resource, Global_ChooseSeason %>" SkinID="SmallHeaderLabel"></asp:Label>
            <asp:DropDownList ID="SeasonDropDownList" runat="server" 
                AutoPostBack="true" DataSourceID="SqlDataSource2" DataTextField="Season" 
                DataValueField="Season Number"  OnSelectedIndexChanged="Button1_Click">
            </asp:DropDownList>
            <%--<asp:Button ID="Button1" runat="server" ValidationGroup = "NewSeason" Text="<%$ Resources:Resource, Global_GoalsHeader %>" 
             CssClass="GreenSmallButtonStyle" onclick="Button1_Click" />--%>
            
            <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="FixturesUpdatePanel" >
                <ProgressTemplate>
                    <div class="ajaxloader" >
                        <asp:Image ID="ProgressImage" runat="server" ImageUrl="~/Images/ajax-loader.gif" />
                    </div>
                </ProgressTemplate>
            </asp:UpdateProgress>
            
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="SeasonDropDownList"
                ErrorMessage="<%$ Resources:Resource, Global_ChooseSeason %>" Height="16px" InitialValue="0" ValidationGroup="NewSeason"
                Style="margin-right: 0px" Width="176px"></asp:RequiredFieldValidator>
                    
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                SelectCommand="Nivdal_SelectSeasonsForLeague" 
                SelectCommandType="StoredProcedure">
            </asp:SqlDataSource>
            <br />
            <asp:Label ID="ErrorLabel" runat="server" Text=""></asp:Label>
            
    
            <asp:HiddenField ID="LeagueIdHiddenField" runat="server" />
            <asp:HiddenField ID="SeasonHiddenField" runat="server" />
            <asp:ListView ID="MatchesListView" runat="server" DataSourceID="RoundsListDataSource">
                <LayoutTemplate>
                    <asp:Label ID="itemplaceholder" runat="server"></asp:Label>
                </LayoutTemplate>
                <ItemTemplate>
                    <asp:HiddenField ID="RoundHiddenField" runat="server" Value='<%# Eval("Round") %>' />
                    <asp:HiddenField ID="LeagueIdHiddenField1" runat="server" Value='<%# Eval("LeagueId") %>' />
                    <asp:HiddenField ID="SeasonHiddenField1" runat="server" Value='<%# Eval("Season") %>' />
                    <asp:Label ID="RoundTitleLabel" runat="server" SkinID="InfoLabel"                    
                    Text="<%$ Resources:Resource, Global_Round %>"></asp:Label>
                    <asp:Label ID="RoundLabel" runat="server" Text='<%# " " + Eval("Round") %>' SkinID="InfoLabel"></asp:Label>
                    <br />
                    <asp:GridView ID="MatchesGridview" runat="server" AutoGenerateColumns="False" 
                        DataSourceID="RoundMatchesSqlDataSourse" SkinID="Professional">
                        <Columns>            
                            <asp:TemplateField ItemStyle-Width="25%" HeaderText="<%$ Resources:Resource, Global_Date %>">
                                <ItemTemplate>
                                    <asp:Label ID="DateLabel" runat="server" Text='<%# Eval("Date") %>' SkinID="GridLabel"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField ItemStyle-Width="60%">                
                                <ItemTemplate>
                                    <asp:LinkButton ID="TitleLinkButton1" runat="server" Text='<%# Eval("Title") %>'
                                    PostBackUrl='<%# Eval("Id", "MatchPage.aspx?MatchId={0}") %>' SkinID="GridLinkButton"></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField ItemStyle-Width="15%" HeaderText="<%$ Resources:Resource, Global_Result %>">                                
                                <ItemTemplate>
                                    <asp:Label ID="ResultLabel" runat="server" Text='<%# Eval("Result") %>' SkinID="GridLabel"
                                     Visible='<%# Eval("Result").ToString().Length != 0 %>'></asp:Label>
                                    <asp:Label ID="NotStartedLabel" runat="server" Text="<%$ Resources:Resource, LeagueFixtures_MatchNotStartedLabelText %>"
                                     SkinID="GridLabel" Visible='<%# Eval("Result").ToString().Length == 0 %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    
                    <asp:SqlDataSource ID="RoundMatchesSqlDataSourse" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                        SelectCommand="Nivdal_GetLeagueRoundMatches" SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="LeagueIdHiddenField1" PropertyName="Value" Name="LeagueId" Type="Decimal" />
                            <asp:ControlParameter ControlID="SeasonHiddenField1" PropertyName="Value" Name="Season" Type="Decimal" />
                            <asp:ControlParameter ControlID="RoundHiddenField" PropertyName="Value" Name="Round" Type="Decimal" />
                            <asp:ControlParameter ControlID="LanguageHiddenField" PropertyName="Value" Name="Language" Type="Decimal"  /> 
                        </SelectParameters>
                    </asp:SqlDataSource>
                </ItemTemplate>
                <ItemSeparatorTemplate>
                    <br />
                </ItemSeparatorTemplate>
            </asp:ListView>
            <br />
            <asp:Hyperlink ID="LeagueLinkButton" runat="server"  SkinID="GreenTitleHyperLink" 
            Text="<%$ Resources:Resource, LeagueFixtures_LeagueLinkButton %>"></asp:Hyperlink>
            <asp:SqlDataSource ID="RoundsListDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                SelectCommand="Nivdal_GetLeagueRoundsList" SelectCommandType="StoredProcedure">   
                <SelectParameters>
                    <asp:ControlParameter ControlID="LeagueIdHiddenField" PropertyName="Value" Type="Decimal" Name="LeagueId" />
                    <asp:ControlParameter ControlID="SeasonHiddenField" PropertyName="Value" Type="Decimal" Name="Season" />
                </SelectParameters>             
            </asp:SqlDataSource>

            </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    
   <%-- <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        SelectCommand="Nivdal_ShowLeagueFixtures" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>--%>
</asp:Content>

